{% extends "base.html" %}

{% block title %}Modify Subuser{% endblock %}

{% block servername %}
<ul class="nav navbar-nav">
	<li class="active dynUpdate" id="{{ server.id }}"><a><i id="applyUpdate" class="fa fa-circle-o-notch fa-spinner fa-spin"></i> {{ server.name }}</a></li>
</ul>
{% endblock %}

{% block sidebar %}
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_acc_actions }}</strong></a>
	<a href="../../account.php" class="list-group-item">{{ lang.sidebar_settings }}</a>
	<a href="../../totp.php" class="list-group-item">TOTP {{ lang.sidebar_settings }}</a>
	<a href="../../servers.php" class="list-group-item">{{ lang.sidebar_servers }}</a>
</div>
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_server_acc }}</strong></a>
	<a href="../index.php" class="list-group-item">{{ lang.sidebar_overview }}</a>
	<a href="../files/index.php" class="list-group-item">{{ lang.sidebar_files }}</a>
	{% if permission.users.view == true %}<a href="list.php" class="list-group-item active">Manage Subusers</a>{% endif %}
	<a href="../settings.php" class="list-group-item">{{ lang.sidebar_manage }}</a>
	<a href="../plugins/index.php" class="list-group-item">{{ lang.sidebar_plugins }}</a>
</div>
{% endblock %}

{% block content %}
<div class="col-9">
	{% if allow_subusers == 1 %}
		{% if get.error %}
			<div class="alert alert-danger">Wowza! You seem to have done something that the system didn't like. Please try again or contact support.</div>
		{% endif %}
		<form action="post/update.php" method="post">
			<h3 class="nopad">Viewing Perissions for: {{ user.email }}</h3><hr />
			<div class="list-group">
				<a href="#" class="list-group-item">
					<label><input type="checkbox" name="permissions[]" value="console.view" {% if permissions.console.view == true %}checked="checked"{% endif %}/> View Console</label>
					<p class="list-group-item-text">Gives user permission to view the console page.</p>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="console.commands" {% if permissions.console.commands == true %}checked="checked"{% endif %}/> Send Commands</label>
							<p class="list-group-item-text">Gives user permission to send commands to the server from the page.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="console.power" {% if permissions.console.power == true %}checked="checked"{% endif %}/> Control Power</label>
							<p class="list-group-item-text">Gives user permission to start, stop, or restart the server.</p>
						</div>
					</div>
				</a>
				<a href="#" class="list-group-item">
					<label><input type="checkbox" name="permissions[]" value="files.view" {% if permissions.files.view == true %}checked="checked"{% endif %}/> View Files</label>
					<p class="list-group-item-text">Gives user permission to view the file listing.</p>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="files.edit" {% if permissions.files.edit == true %}checked="checked"{% endif %}/> Edit File</label>
							<p class="list-group-item-text">Gives user permission to open a file for editing.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="files.save" {% if permissions.files.save == true %}checked="checked"{% endif %}/> Save Modifications</label>
							<p class="list-group-item-text">Gives user permission to save a modified version of a file.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="files.download" {% if permissions.files.download == true %}checked="checked"{% endif %}/> Download Files</label>
							<p class="list-group-item-text">Gives user permission to download files from the server.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="files.delete" {% if permissions.files.delete == true %}checked="checked"{% endif %}/> Delete Files <span class="label label-danger">Danger</span></label>
							<p class="list-group-item-text">Gives user permission to delete files on the server.</p>
						</div>
					</div>
				</a>
				<a href="#" class="list-group-item">
					<label><input type="checkbox" name="permissions[]" value="manage.view" {% if permissions.manage.view == true %}checked="checked"{% endif %}/> View Manager</label>
					<p class="list-group-item-text">Gives user permission to view the server management page.</p>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="manage.rename.view" {% if permissions.manage.rename.view == true %}checked="checked"{% endif %}/> View Server Jar Tab</label>
							<p class="list-group-item-text">Gives user permission to view the Server Jar Tab.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-2"><br /><br /></div>
						<div class="col-10">
							<label><input type="checkbox" name="permissions[]" value="manage.rename.jar" {% if permissions.manage.rename.jar == true %}checked="checked"{% endif %}/> Modify Jar File Name</label>
							<p class="list-group-item-text">Gives user permission modify the jar file name for a server.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-1"><br /><br /></div>
						<div class="col-11">
							<label><input type="checkbox" name="permissions[]" value="manage.ftp.view" {% if permissions.manage.ftp.view == true %}checked="checked"{% endif %}/> View FTP Tab</label>
							<p class="list-group-item-text">Gives user permission to view the FTP tab.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-2"><br /><br /></div>
						<div class="col-10">
							<label><input type="checkbox" name="permissions[]" value="manage.ftp.details" {% if permissions.manage.ftp.details == true %}checked="checked"{% endif %}/> View FTP Details</label>
							<p class="list-group-item-text">Gives user permission to view the connection information (including username) for the server's FTP.</p>
						</div>
					</div>
					<div class="row" style="margin-top:10px;">
						<div class="col-2"><br /><br /></div>
						<div class="col-10">
							<label><input type="checkbox" name="permissions[]" value="manage.ftp.password" {% if permissions.manage.ftp.password == true %}checked="checked"{% endif %}/> Modify FTP Password <span class="label label-danger">Danger</span></label>
							<p class="list-group-item-text">Gives user permission to modify the server FTP password.</p>
						</div>
					</div>
				</a>
			</div>
			<div class="form-group">
				<div>
					{{ xsrf|raw }}
					<input type="hidden" name="uuid" value="{{ get.id }}" />
					<input type="submit" value="Update Permissions" class="btn btn-primary" />
					<a href="post/revoke.php?uid={{ get.id }}"><button class="btn btn-sm btn-danger" type="button"/>Delete User</button></a>
				</div>
			</div>
		</form>
	{% else %}
		<div class="alert alert-danger">This function has not been enabled by your host.</div>
	{% endif %}
</div>
{% endblock %}